// JavaScript Document
function HashTable(){
	var specialkey=[
		"valueOf",
		"hasOwnProperty",
		"isPrototypeOf",
		"propertyIsEnumerable",
		"prototype",
		"constructor",
		"toLocaleString",
		"toString"
	];
	var len=specialkey.length;
	var specialvalue=new Array(len);
	var specialflag=new Array(len);
	var normalHashTable={};
	var length=0;
	
	this.insert=function(key,value){
		for(var i=0;i<len;i++){
			if(key===specialkey[i]){
				if(!specialflag[i]){
					specialvalue[i]=value;
					specialflag[i]=true;
					length++;
					return true;
				}else{
					return false;
				}
			}
		}
		if(key in normalHashTable) return false;
		normalHashTable[key]=value;
		length++
		return true;
	}
	this.update=function(key,value){
		for(var i=0;i<len;i++){
			if(key===specialkey[i]){
				specialvalue[i]=value;
				specialflag[i]=true;
				return true;
			}
		}
		if(key in normalHashTable){
			normalHashTable[key]=value;
			return true;
		}else{
			return false;
		}
	}
	this.remove=function(key){
		for(var i=0;i<len;i++){
			if(key===specialkey[i]){
				specialvalue[i]=null;
				specialflag[i]=false;
				length--;
				return true;
			}
		}
		if(key in normalHashTable){
			delete normalHashTable[key];
			length--;
			return true;
		}else{
			return false;
		}
	}
	this.removeAll=function(){
		for(var i=0;i<len;i++){
			if(specialflag[i]){
				specialvalue[i]=null;
				specialflag[i]=false;
			}
		}
		normalHashTable={};
		length=0;
	}
	this.search=function(key){
		for(var i=0;i<len;i++){
			if(key===specialkey[i]){
				if(specialflag[i]){
					return specialvalue[i];
				}else{
					return null;
				}
			}
		}
		if(key in normalHashTable){
			return normalHashTable[key];
		}else{
			return null;
		}
	}
	this.count=function(){
		return length;
	}
	
	
}